#install.packages("tm")
library(tm)
## Loading required package: NLP
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
pom <- VCorpus(DirSource("./Data", ignore.case = TRUE, mode = "text"))
str(pom)
## Classes 'VCorpus', 'Corpus' hidden list of 3
## $ content:List of 1
## ..$ :List of 2
## .. ..$ content: chr [1:6942] "" "CHAPTER I" "" "ON THE ARIZONA HILLS" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "APrincessOfMars.txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## $ meta : list()
## ..- attr(*, "class")= chr "CorpusMeta"
## $ dmeta :'data.frame': 1 obs. of 0 variables
pom
## <<VCorpus>>
## Metadata: corpus specific: 0, document level (indexed): 0
## Content: documents: 1
pomtext <- pom[[1]]
pomtext
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 357399
pomtext[[1]][1:10]
## [1] ""
## [2] "CHAPTER I"
## [3] ""
## [4] "ON THE ARIZONA HILLS"
## [5] ""
## [6] ""
## [7] "I am a very old man; how old I do not know. Possibly I am a hundred,"
## [8] "possibly more; but I cannot tell because I have never aged as other"
## [9] "men, nor do I remember any childhood. So far as I can recollect I have"
## [10] "always been a man, a man of about thirty. I appear today as I did"
pombook <- pomtext[[1]]
chap_idx = c()
for(i in 1:length(pombook)){
if(grepl("CHAPTER ", pombook[i])){
chap_idx <- append(chap_idx, i)
print(pombook[i])
}
}
## [1] "CHAPTER I"
## [1] "CHAPTER II"
## [1] "CHAPTER III"
## [1] "CHAPTER IV"
## [1] "CHAPTER V"
## [1] "CHAPTER VI"
## [1] "CHAPTER VII"
## [1] "CHAPTER VIII"
## [1] "CHAPTER IX"
## [1] "CHAPTER X"
## [1] "CHAPTER XI"
## [1] "CHAPTER XII"
## [1] "CHAPTER XIII"
## [1] "CHAPTER XIV"
## [1] "CHAPTER XV"
## [1] "CHAPTER XVI"
## [1] "CHAPTER XVII"
## [1] "CHAPTER XVIII"
## [1] "CHAPTER XIX"
## [1] "CHAPTER XX"
## [1] "CHAPTER XXI"
## [1] "CHAPTER XXII"
## [1] "CHAPTER XXIII"
## [1] "CHAPTER XXIV"
## [1] "CHAPTER XXV"
## [1] "CHAPTER XXVI"
## [1] "CHAPTER XXVII"
## [1] "CHAPTER XXVIII"
lst_chap_idx <- tail(chap_idx,1)
lst_book_idx <- length(pombook)
pom_chapter <- character()
for(i in seq(1, length(chap_idx))){
from <- chap_idx[i]+1
if(chap_idx[i] == lst_chap_idx){
to <- lst_book_idx-1
} else {
to <- chap_idx[i+1]-1
}
assign(paste0("chapter_",i), pombook[from:to])
}
head(chapter_1)
## [1] ""
## [2] "ON THE ARIZONA HILLS"
## [3] ""
## [4] ""
## [5] "I am a very old man; how old I do not know. Possibly I am a hundred,"
## [6] "possibly more; but I cannot tell because I have never aged as other"
if (!dir.exists("./Data/chapters")){
dir.create("./Data/chapters")
}else{
print("Chapters dir exists")
}
## [1] "Chapters dir exists"
for(i in seq(1, length(chap_idx))){
ch <- get(eval(paste0("chapter_",i)))
file <- paste("./Data/chapters/chapter_",i,".txt")
write.table(ch, file=file, sep="\t", row.names=FALSE, col.names=FALSE,quote=FALSE);
}
pom2 <- VCorpus(DirSource("./Data/chapters", ignore.case = TRUE, mode = "text"))
str(pom2)
## Classes 'VCorpus', 'Corpus' hidden list of 3
## $ content:List of 28
## ..$ :List of 2
## .. ..$ content: chr [1:267] "" "ON THE ARIZONA HILLS" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 1 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:358] "" "CHAMPION AND CHIEF" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 10 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:258] "" "WITH DEJAH THORIS" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 11 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:204] "" "A PRISONER WITH POWER" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 12 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:244] "" "LOVE-MAKING ON MARS" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 13 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:350] "" "A DUEL TO THE DEATH" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 14 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:313] "" "SOLA TELLS ME HER STORY" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 15 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:369] "" "WE PLAN ESCAPE" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 16 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:289] "" "A COSTLY RECAPTURE" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 17 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:167] "" "CHAINED IN WARHOON" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 18 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:183] "" "BATTLING IN THE ARENA" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 19 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:166] "" "THE ESCAPE OF THE DEAD" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 2 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:341] "" "IN THE ATMOSPHERE FACTORY" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 20 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:373] "" "AN AIR SCOUT FOR ZODANGA" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 21 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:389] "" "I FIND DEJAH" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 22 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:240] "" "LOST IN THE SKY" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 23 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:289] "" "TARS TARKAS FINDS A FRIEND" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 24 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:193] "" "THE LOOTING OF ZODANGA" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 25 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:254] "" "THROUGH CARNAGE TO JOY" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 26 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:225] "" "FROM JOY TO DEATH" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 27 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:75] "" "AT THE ARIZONA CAVE" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 28 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:268] "" "MY ADVENT ON MARS" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 3 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:221] "" "A PRISONER" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 4 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:152] "" "I ELUDE MY WATCH DOG" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 5 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:165] "" "A FIGHT THAT WON FRIENDS" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 6 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:204] "" "CHILD-RAISING ON MARS" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 7 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:207] "" "A FAIR CAPTIVE FROM THE SKY" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 8 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:148] "" "I LEARN THE LANGUAGE" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 9 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## $ meta : list()
## ..- attr(*, "class")= chr "CorpusMeta"
## $ dmeta :'data.frame': 28 obs. of 0 variables
pom2
## <<VCorpus>>
## Metadata: corpus specific: 0, document level (indexed): 0
## Content: documents: 28
for(ch in 1:length(chap_idx)){
curr_chapter <- get(eval(paste0("chapter_",ch)))
len <- length(curr_chapter)
word_list <- character()
all_sentence <- character()
sentence_list <- character()
for(i in 1:len){
words <- c(strsplit(curr_chapter[i], split=" ")[[1]])
word_list <- append(word_list, words)
all_sentence <- paste(all_sentence, curr_chapter[i])
}
sentence_list <- c(strsplit(all_sentence, split="[.]")[[1]])
word_len <- nchar(word_list)
word_df <- data.frame("word" = word_list, "word_len" = word_len)
word_df <- word_df %>% arrange(desc(word_len))
assign(paste0("df_lon_wrd_chap_",ch), word_df[1:10,])
sen_len <- nchar(sentence_list)
sen_df <- data.frame("sentence" = sentence_list, "sentence_len" = sen_len)
sen_df <- sen_df %>% arrange(desc(sen_len))
assign(paste0("df_lon_sen_chap_",ch), sen_df[1:10,])
if(ch < 12){
print(paste("Longest words and sentences for chapter",ch))
print(get(eval(paste0("df_lon_wrd_chap_",ch))))
print(get(eval(paste0("df_lon_sen_chap_",ch))))
}
}
## [1] "Longest words and sentences for chapter 1"
## word word_len
## 1 sensitiveness, 14
## 2 subconsciously 14
## 3 characteristic 14
## 4 resuscitation. 14
## 5 resurrection. 13
## 6 substantiate. 13
## 7 understanding 13
## 8 (Confederate) 13
## 9 civilization, 13
## 10 comparatively 13
## sentence
## 1 However, I am not prone to sensitiveness, and the following of a sense of duty, wherever it may lead, has always been a kind of fetich with me throughout my life; which may account for the honors bestowed upon me by three republics and the decorations and friendships of an old and powerful emperor and several lesser kings, in whose service my sword has been red many a time
## 2 The fact that it is difficult to aim anything but imprecations accurately by moonlight, that they were upset by the sudden and unexpected manner of my advent, and that I was a rather rapidly moving target saved me from the various deadly projectiles of the enemy and permitted me to reach the shadows of the surrounding peaks before an orderly pursuit could be organized
## 3 Since we had entered the territory we had not seen a hostile Indian, and we had, therefore, become careless in the extreme, and were wont to ridicule the stories we had heard of the great numbers of these vicious marauders that were supposed to haunt the trails, taking their toll in lives and torture of every white party which fell into their merciless clutches
## 4 In this instance I was, of course, positive that Powell was the center of attraction, but whether I thought or acted first I do not know, but within an instant from the moment the scene broke upon my view I had whipped out my revolvers and was charging down upon the entire army of warriors, shooting rapidly, and whooping at the top of my lungs
## 5 The morning of Powell's departure was, like nearly all Arizona mornings, clear and beautiful; I could see him and his little pack animals picking their way down the mountainside toward the valley, and all during the morning I would catch occasional glimpses of them as they topped a hog back or came out upon a level plateau
## 6 My horse was traveling practically unguided as I knew that I had probably less knowledge of the exact location of the trail to the pass than he, and thus it happened that he entered a defile which led to the summit of the range and not to the pass which I had hoped would carry me to the valley and to safety
## 7 I do not believe that I am made of the stuff which constitutes heroes, because, in all of the hundreds of instances that my voluntary acts have placed me face to face with death, I cannot recall a single one where any alternative step to that I took occurred to me until many hours later
## 8 I was positive now that the trailers were Apaches and that they wished to capture Powell alive for the fiendish pleasure of the torture, so I urged my horse onward at a most dangerous pace, hoping against hope that I would catch up with the red rascals before they attacked him
## 9 I soon became so drowsy that I could scarcely resist the strong desire to throw myself on the floor of the cave for a few moments' rest, but I knew that this would never do, as it would mean certain death at the hands of my red friends, who might be upon me at any moment
## 10 I know that the average human mind will not believe what it cannot grasp, and so I do not purpose being pilloried by the public, the pulpit, and the press, and held up as a colossal liar when I am but telling the simple truths which some day science will substantiate
## sentence_len
## 1 377
## 2 372
## 3 365
## 4 347
## 5 326
## 6 310
## 7 289
## 8 279
## 9 273
## 10 269
## [1] "Longest words and sentences for chapter 2"
## word word_len
## 1 panic-stricken. 15
## 2 fascination--it 15
## 3 paint-streaked 14
## 4 metamorphosis. 14
## 5 war-bonneted, 13
## 6 contemplation 13
## 7 interruption. 13
## 8 bewilderment; 13
## 9 apprehension. 13
## 10 cacti-studded 13
## sentence
## 1 Few western wonders are more inspiring than the beauties of an Arizona moonlit landscape; the silvered mountains in the distance, the strange lights and shadows upon hog back and arroyo, and the grotesque details of the stiff, yet beautiful cacti form a picture at once enchanting and inspiring; as though one were catching for the first time a glimpse of some dead and forgotten world, so different is it from the aspect of any other spot upon our earth
## 2 I reasoned with myself that I had lain helpless for many hours within the cave, yet nothing had molested me, and my better judgment, when permitted the direction of clear and logical reasoning, convinced me that the noises I had heard must have resulted from purely natural and harmless causes; probably the conformation of the cave was such that a slight breeze had caused the sounds I heard
## 3 To be held paralyzed, with one's back toward some horrible and unknown danger from the very sound of which the ferocious Apache warriors turn in wild stampede, as a flock of sheep would madly flee from a pack of wolves, seems to me the last word in fearsome predicaments for a man who had ever been used to fighting for his life with all the energy of a powerful physique
## 4 Fear is a relative term and so I can only measure my feelings at that time by what I had experienced in previous positions of danger and by those that I have passed through since; but I can say without shame that if the sensations I endured during the next few minutes were fear, then may God help the coward, for cowardice is of a surety its own punishment
## 5 Late in the afternoon my horse, which had been standing with dragging rein before the cave, started slowly down the trail, evidently in search of food and water, and I was left alone with my mysterious unknown companion and the dead body of my friend, which lay just within my range of vision upon the ledge where I had placed it in the early morning
## 6 My first thought was, is this then death! Have I indeed passed over forever into that other life! But I could not well believe this, as I could feel my heart pounding against my ribs from the exertion of my efforts to release myself from the anaesthesis which had held me
## 7 From then until possibly midnight all was silence, the silence of the dead; then, suddenly, the awful moan of the morning broke upon my startled ears, and there came again from the black shadows the sound of a moving thing, and a faint rustling as of dead leaves
## 8 My only alternative seemed to lie in flight and my decision was crystallized by a recurrence of the rustling sound from the thing which now seemed, in the darkness of the cave and to my distorted imagination, to be creeping stealthily upon me
## 9 There also came to my nostrils a faintly pungent odor, and I could only assume that I had been overcome by some poisonous gas, but why I should retain my mental faculties and yet be unable to move I could not fathom
## 10 I had not long to wait before a stealthy sound apprised me of their nearness, and then a war-bonneted, paint-streaked face was thrust cautiously around the shoulder of the cliff, and savage eyes looked into mine
## sentence_len
## 1 456
## 2 394
## 3 373
## 4 359
## 5 352
## 6 275
## 7 264
## 8 244
## 9 217
## 10 213
## [1] "Longest words and sentences for chapter 3"
## word word_len
## 1 yellowish-green 15
## 2 characteristics 15
## 3 strange-looking 15
## 4 irregularities 14
## 5 quartz-bearing 14
## 6 characteristic 14
## 7 consciousness 13
## 8 independently 13
## 9 accouterments 13
## 10 noiselessness 13
## sentence
## 1 The throwing down of his weapons and the withdrawing of his troop before his advance toward me would have signified a peaceful mission anywhere on Earth, so why not, then, on Mars! Placing my hand over my heart I bowed low to the Martian and explained to him that while I did not understand his language, his actions spoke for the peace and friendship that at the present moment were most dear to my heart
## 2 He sat his mount as we sit a horse, grasping the animal's barrel with his lower limbs, while the hands of his two right arms held his immense spear low at the side of his mount; his two left arms were outstretched laterally to help preserve his balance, the thing he rode having neither bridle or reins of any description for guidance
## 3 Their eyes were set at the extreme sides of their heads a trifle above the center and protruded in such a manner that they could be directed either forward or back and also independently of each other, thus permitting this queer animal to look in any direction, or in two directions at once, without the necessity of turning the head
## 4 And his mount! How can earthly words describe it! It towered ten feet at the shoulder; had four legs on either side; a broad flat tail, larger at the tip than at the root, and which it held straight out behind while running; a gaping mouth which split its head from its snout to its long, massive neck
## 5 The respite my unexpected agility had given me permitted me to formulate plans for the immediate future and to note more closely the appearance of the warriors, for I could not disassociate these people in my mind from those other warriors who, only the day before, had been pursuing me
## 6 The result is that they are infinitely less agile and less powerful, in proportion to their weight, than an Earth man, and I doubt that were one of them suddenly to be transported to Earth he could lift his own weight from the ground; in fact, I am convinced that he could not do so
## 7 Coming, as they did, over the soft and soundless moss, which covers practically the entire surface of Mars with the exception of the frozen areas at the poles and the scattered cultivated districts, they might have captured me easily, but their intentions were far more sinister
## 8 But the little sound caused me to turn, and there upon me, not ten feet from my breast, was the point of that huge spear, a spear forty feet long, tipped with gleaming metal, and held low at the side of a mounted replica of the little devils I had been watching
## 9 Instead of progressing in a sane and dignified manner, my attempts to walk resulted in a variety of hops which took me clear of the ground a couple of feet at each step and landed me sprawling upon my face or back at the end of each second or third hop
## 10 Behind this first charging demon trailed nineteen others, similar in all respects, but, as I learned later, bearing individual characteristics peculiar to themselves; precisely as no two of us are identical although we are all cast in a similar mold
## sentence_len
## 1 408
## 2 336
## 3 335
## 4 305
## 5 288
## 6 283
## 7 280
## 8 263
## 9 254
## 10 251
## [1] "Longest words and sentences for chapter 4"
## word word_len
## 1 peaceful--otherwise 19
## 2 vice-chieftain 14
## 3 circumstances 13
## 4 consideration 13
## 5 manifestation 13
## 6 consideration 13
## 7 seventy-nine 12
## 8 one-thousand 12
## 9 therapeutics 12
## 10 communities. 12
## sentence
## 1 I saw no signs of extreme age among them, nor is there any appreciable difference in their appearance from the age of maturity, about forty, until, at about the age of one thousand years, they go voluntarily upon their last strange pilgrimage down the river Iss, which leads no living Martian knows whither and from whose bosom no Martian has ever returned, or would be allowed to live did he return after once embarking upon its cold, dark waters
## 2 They first repeated the word "sak" a number of times, and then Tars Tarkas made several jumps, repeating the same word before each leap; then, turning to me, he said, "sak!" I saw what they were after, and gathering myself together I "sakked" with such marvelous success that I cleared a good hundred and fifty feet; nor did I, this time, lose my equilibrium, but landed squarely upon my feet without falling
## 3 What struck me as most remarkable about this assemblage and the hall in which they were congregated was the fact that the creatures were entirely out of proportion to the desks, chairs, and other furnishings; these being of a size adapted to human beings such as I, whereas the great bulks of the Martians could scarcely have squeezed into the chairs, nor was there room beneath the desks for their long legs
## 4 My exhibition had been witnessed by several hundred lesser Martians, and they immediately broke into demands for a repetition, which the chieftain then ordered me to make; but I was both hungry and thirsty, and determined on the spot that my only method of salvation was to demand the consideration from these creatures which they evidently would not voluntarily accord
## 5 The room was well lighted by a number of large windows and was beautifully decorated with mural paintings and mosaics, but upon all there seemed to rest that indefinable touch of the finger of antiquity which convinced me that the architects and builders of these wondrous creations had nothing in common with the crude half-brutes which now occupied them
## 6 Owing to the waning resources of the planet it evidently became necessary to counteract the increasing longevity which their remarkable skill in therapeutics and surgery produced, and so human life has come to be considered but lightly on Mars, as is evidenced by their dangerous sports and the almost continual warfare between the various communities
## 7 Evidently, then, there were other denizens on Mars than the wild and grotesque creatures into whose hands I had fallen, but the evidences of extreme antiquity which showed all around me indicated that these buildings might have belonged to some long-extinct and forgotten race in the dim antiquity of Mars
## 8 As he banged me down upon my feet his face was bent close to mine and I did the only thing a gentleman might do under the circumstances of brutality, boorishness, and lack of consideration for a stranger's rights; I swung my fist squarely to his jaw and he went down like a felled ox
## 9 Toward the center of the city was a large plaza, and upon this and in the buildings immediately surrounding it were camped some nine or ten hundred creatures of the same breed as my captors, for such I now considered them despite the suave manner in which I had been trapped
## 10 Had the men been strangers, and therefore unable to exchange names, they would have silently exchanged ornaments, had their missions been peaceful--otherwise they would have exchanged shots, or have fought out their introduction with some other of their various weapons
## sentence_len
## 1 449
## 2 411
## 3 410
## 4 371
## 5 357
## 6 353
## 7 306
## 8 285
## 9 276
## 10 271
## [1] "Longest words and sentences for chapter 5"
## word word_len
## 1 ferocious-looking 17
## 2 gardens--scenes 15
## 3 characteristics 15
## 4 wicked-looking 14
## 5 representation 14
## 6 uncomfortable, 14
## 7 ministrations 13
## 8 semi-barbaric 13
## 9 intelligence, 13
## 10 invigorated, 12
## sentence
## 1 The nights are either brilliantly illumined or very dark, for if neither of the two moons of Mars happen to be in the sky almost total darkness results, since the lack of atmosphere, or, rather, the very thin atmosphere, fails to diffuse the starlight to any great extent; on the other hand, if both of the moons are in the heavens at night the surface of the ground is brightly illuminated
## 2 This last device produces an intensely brilliant far-reaching white light, but as the natural oil which it requires can only be obtained by mining in one of several widely separated and remote localities it is seldom used by these creatures whose only thought is for today, and whose hatred for manual labor has kept them in a semi-barbaric state for countless ages
## 3 I could not but wonder what this ferocious-looking monstrosity might do when left alone in such close proximity to such a relatively tender morsel of meat; but my fears were groundless, as the beast, after surveying me intently for a moment, crossed the room to the only exit which led to the street, and lay down full length across the threshold
## 4 And it is well that nature has so graciously and abundantly lighted the Martian night, for the green men of Mars, being a nomadic race without high intellectual development, have but crude means for artificial lighting; depending principally upon torches, a kind of candle, and a peculiar oil lamp which generates a gas and burns without a wick
## 5 It came, as I later discovered, not from an animal, as there is only one mammal on Mars and that one very rare indeed, but from a large plant which grows practically without water, but seems to distill its plentiful supply of milk from the products of the soil, the moisture of the air, and the rays of the sun
## 6 The work had evidently been wrought by a master hand, so subtle the atmosphere, so perfect the technique; yet nowhere was there a representation of a living animal, either human or brute, by which I could guess at the likeness of these other and perhaps extinct denizens of Mars
## 7 Both of Mars' moons are vastly nearer her than is our moon to Earth; the nearer moon being but about five thousand miles distant, while the further is but little more than fourteen thousand miles away, against the nearly one-quarter million miles which separate us from our moon
## 8 The nearer moon of Mars makes a complete revolution around the planet in a little over seven and one-half hours, so that she may be seen hurtling through the sky like some huge meteor two or three times each night, revealing all her phases during each transit of the heavens
## 9 Across the threshold lay stretched the sleepless guardian brute, just as I had last seen him on the preceding day; apparently he had not moved a muscle; his eyes were fairly glued upon me, and I fell to wondering just what might befall me should I endeavor to escape
## 10 This girl alone, among all the green Martians with whom I came in contact, disclosed characteristics of sympathy, kindliness, and affection; her ministrations to my bodily wants were unfailing, and her solicitous care saved me from much suffering and many hardships
## sentence_len
## 1 392
## 2 367
## 3 348
## 4 346
## 5 312
## 6 280
## 7 280
## 8 275
## 9 268
## 10 267
## [1] "Longest words and sentences for chapter 6"
## word word_len
## 1 fearsome-looking 16
## 2 non-protruding; 15
## 3 overwhelmingly 14
## 4 myriad-legged 13
## 5 accomplishing 13
## 6 gesticulated 12
## 7 intermediary 12
## 8 executioner. 12
## 9 watch-thing; 12
## 10 transcending 12
## sentence
## 1 My beast had an advantage in his first hold, having sunk his mighty fangs far into the breast of his adversary; but the great arms and paws of the ape, backed by muscles far transcending those of the Martian men I had seen, had locked the throat of my guardian and slowly were choking out his life, and bending back his head and neck upon his body, where I momentarily expected the former to fall limp at the end of a broken neck
## 2 I am ever willing to stand and fight when the odds are not too overwhelmingly against me, but in this instance I perceived neither glory nor profit in pitting my relatively puny strength against the iron muscles and brutal ferocity of this enraged denizen of an unknown world; in fact, the only outcome of such an encounter, so far as I might be concerned, seemed sudden death
## 3 I had at least two friends on Mars; a young woman who watched over me with motherly solicitude, and a dumb brute which, as I later came to know, held in its poor ugly carcass more love, more loyalty, more gratitude than could have been found in the entire five million green Martians who rove the deserted cities and dead sea bottoms of Mars
## 4 Suddenly I came to myself and, with that strange instinct which seems ever to prompt me to my duty, I seized the cudgel, which had fallen to the floor at the commencement of the battle, and swinging it with all the power of my earthly arms I crashed it full upon the head of the ape, crushing his skull as though it had been an eggshell
## 5 It is true I held the cudgel, but what could I do with it against his four great arms? Even should I break one of them with my first blow, for I figured that he would attempt to ward off the cudgel, he could reach out and annihilate me with the others before I could recover for a second attack
## 6 Evidently devoid of all the finer sentiments of friendship, love, or affection, these people fairly worship physical prowess and bravery, and nothing is too good for the object of their adoration as long as he maintains his position by repeated examples of his skill, strength, and courage
## 7 I was standing near the window and I knew that once in the street I might gain the plaza and safety before the creature could overtake me; at least there was a chance for safety in flight, against almost certain death should I remain and fight however desperately
## 8 With a shriek of fear the ape which held me leaped through the open window, but its mate closed in a terrific death struggle with my preserver, which was nothing less than my faithful watch-thing; I cannot bring myself to call so hideous a creature a dog
## 9 I glimpsed him just before he reached the doorway and the sight of him, now roaring as he perceived his lifeless fellow stretched upon the floor, and frothing at the mouth, in the extremity of his rage, filled me, I must confess, with dire forebodings
## 10 They seemed to be deep in argument, and finally one of them addressed me, but remembering my ignorance of his language turned back to Tars Tarkas, who, with a word and gesture, gave some command to the fellow and turned to follow us from the room
## sentence_len
## 1 431
## 2 378
## 3 343
## 4 338
## 5 297
## 6 291
## 7 265
## 8 256
## 9 253
## 10 248
## [1] "Longest words and sentences for chapter 7"
## word word_len
## 1 conversations. 14
## 2 children--were 14
## 3 representative 14
## 4 circumstances. 14
## 5 CHILD-RAISING 13
## 6 three-wheeled 13
## 7 conversation, 13
## 8 satisfaction, 13
## 9 unnecessarily 13
## 10 intentionally 13
## sentence
## 1 Between these walls the little Martians scampered, wild as deer; being permitted to run the full length of the aisle, where they were captured one at a time by the women and older children; the last in the line capturing the first little one to reach the end of the gauntlet, her opposite in the line capturing the second, and so on until all the little fellows had left the enclosure and been appropriated by some youth or female
## 2 CHILD-RAISING ON MARS After a breakfast, which was an exact replica of the meal of the preceding day and an index of practically every meal which followed while I was with the green men of Mars, Sola escorted me to the plaza, where I found the entire community engaged in watching or helping at the harnessing of huge mastodonian animals to great three-wheeled chariots
## 3 I do not mean that the adult Martians are unnecessarily or intentionally cruel to the young, but theirs is a hard and pitiless struggle for existence upon a dying planet, the natural resources of which have dwindled to a point where the support of each additional life means an added tax upon the community into which it is thrown
## 4 Entirely unknown to their mothers, who, in turn, would have difficulty in pointing out the fathers with any degree of accuracy, they are the common children of the community, and their education devolves upon the females who chance to capture them as they leave the incubator
## 5 They were not wanted, as their offspring might inherit and transmit the tendency to prolonged incubation, and thus upset the system which has maintained for ages and which permits the adult Martians to figure the proper time for return to the incubators, almost to an hour
## 6 Every one but myself--men, women, and children--were heavily armed, and at the tail of each chariot trotted a Martian hound, my own beast following closely behind ours; in fact, the faithful creature never left me voluntarily during the entire ten years I spent on Mars
## 7 " I saw that he wanted me to repeat my performance of yesterday for the edification of Lorquas Ptomel, and, as I must confess that my prowess gave me no little satisfaction, I responded quickly, leaping entirely over the parked chariots on the far side of the incubator
## 8 It is the universal language of Mars, through the medium of which the higher and lower animals of this world of paradoxes are able to communicate to a greater or less extent, depending upon the intellectual sphere of the species and the development of the individual
## 9 As I later learned, they had been to the subterranean vaults in which the eggs were kept and had transported them to the incubator, which they had then walled up for another five years, and which, in all probability, would not be visited again during that period
## 10 Sola's duties were now doubled, as she was compelled to care for the young Martian as well as for me, but neither one of us required much attention, and as we were both about equally advanced in Martian education, Sola took it upon herself to train us together
## sentence_len
## 1 432
## 2 373
## 3 332
## 4 277
## 5 274
## 6 271
## 7 270
## 8 268
## 9 264
## 10 262
## [1] "Longest words and sentences for chapter 8"
## word word_len
## 1 reinforcements. 15
## 2 simultaneously 14
## 3 hallucination, 14
## 4 gray-painted, 13
## 5 circumstances 13
## 6 southeasterly 13
## 7 requisitioned 13
## 8 southwesterly 13
## 9 awe-inspiring 13
## 10 unaccountably 13
## sentence
## 1 For example, a proportion of them, always the best marksmen, direct their fire entirely upon the wireless finding and sighting apparatus of the big guns of an attacking naval force; another detail attends to the smaller guns in the same way; others pick off the gunners; still others the officers; while certain other quotas concentrate their attention upon the other members of the crew, upon the upper works, and upon the steering gear and propellers
## 2 Instantly the scene changed as by magic; the foremost vessel swung broadside toward us, and bringing her guns into play returned our fire, at the same time moving parallel to our front for a short distance and then turning back with the evident intention of completing a great circle which would bring her up to position once more opposite our firing line; the other vessels followed in her wake, each one opening upon us as she swung into position
## 3 As Sola and I entered the plaza a sight met my eyes which filled my whole being with a great surge of mingled hope, fear, exultation, and depression, and yet most dominant was a subtle sense of relief and happiness; for just as we neared the throng of Martians I caught a glimpse of the prisoner from the battle craft who was being roughly dragged into a nearby building by a couple of green Martian females
## 4 Sola and I had entered a building upon the front of the city, in fact, the same one in which I had had my encounter with the apes, and, wishing to see what had caused the sudden retreat, I mounted to an upper floor and peered from the window out over the valley and the hills beyond; and there I saw the cause of their sudden scurrying to cover
## 5 I could not fathom the seeming hallucination, nor could I free myself from it; but somewhere in the innermost recesses of my soul I felt a strange yearning toward these unknown foemen, and a mighty hope surged through me that the fleet would return and demand a reckoning from the green warriors who had so ruthlessly and wantonly attacked it
## 6 Whether they had discovered us or simply were looking at the deserted city I could not say, but in any event they received a rude reception, for suddenly and without warning the green Martian warriors fired a terrific volley from the windows of the buildings facing the little valley across which the great ships were so peacefully advancing
## 7 This operation required several hours, during which time a number of the chariots were requisitioned to transport the loot, which consisted in arms, ammunition, silks, furs, jewels, strangely carved stone vessels, and a quantity of solid foods and liquids, including many casks of water, the first I had seen since my advent upon Mars
## 8 The sight was awe-inspiring in the extreme as one contemplated this mighty floating funeral pyre, drifting unguided and unmanned through the lonely wastes of the Martian heavens; a derelict of death and destruction, typifying the life story of these strange and ferocious creatures into whose unfriendly hands fate had carried it
## 9 As the craft neared the building, and just before she struck, the Martian warriors swarmed upon her from the windows, and with their great spears eased the shock of the collision, and in a few moments they had thrown out grappling hooks and the big boat was being hauled to ground by their fellows below
## 10 It had never been given me to see such deadly accuracy of aim, and it seemed as though a little figure on one of the craft dropped at the explosion of each bullet, while the banners and upper works dissolved in spurts of flame as the irresistible projectiles of our warriors mowed through them
## sentence_len
## 1 454
## 2 450
## 3 409
## 4 346
## 5 344
## 6 343
## 7 336
## 8 331
## 9 305
## 10 295
## [1] "Longest words and sentences for chapter 9"
## word word_len
## 1 responsibilities 16
## 2 expressionless 14
## 3 unintelligible 14
## 4 administration 14
## 5 possibilities. 14
## 6 accouterments 13
## 7 importunities 13
## 8 countenance. 12
## 9 proportions, 12
## 10 satisfactory 12
## sentence
## 1 Oh, it is one continual, awful period of bloodshed from the time we break the shell until we gladly embrace the bosom of the river of mystery, the dark and ancient Iss which carries us to an unknown, but at least no more frightful and terrible existence! Fortunate indeed is he who meets his end in an early death
## 2 With this added incentive I nearly drove Sola distracted by my importunities to hasten on my education and within a few more days I had mastered the Martian tongue sufficiently well to enable me to carry on a passable conversation and to fully understand practically all that I heard
## 3 "When," asked one of the women, "will we enjoy the death throes of the red one? or does Lorquas Ptomel, Jed, intend holding her for ransom?" "They have decided to carry her with us back to Thark, and exhibit her last agonies at the great games before Tal Hajus," replied Sarkoja
## 4 Customs have been handed down by ages of repetition, but the punishment for ignoring a custom is a matter for individual treatment by a jury of the culprit's peers, and I may say that justice seldom misses fire, but seems rather to rule in inverse ratio to the ascendency of law
## 5 The training of myself and the young Martians was conducted solely by the women, who not only attend to the education of the young in the arts of individual defense and offense, but are also the artisans who produce every manufactured article wrought by the green Martians
## 6 I could not but note the unnecessary harshness and brutality with which her guards treated her; so different from the almost maternal kindliness which Sola manifested toward me, and the respectful attitude of the few green Martians who took the trouble to notice me at all
## 7 After they had retired for the night it was customary for the adults to carry on a desultory conversation for a short time before lapsing into sleep, and now that I could understand their language I was always a keen listener, although I never proffered any remarks myself
## 8 I knew that she was fond of me, and now that I had discovered that she hated cruelty and barbarity I was confident that I could depend upon her to aid me and the girl captive to escape, provided of course that such a thing was within the range of possibilities
## 9 They live at peace with all their fellows, except when duty calls upon them to make war, while we are at peace with none; forever warring among our own kind as well as upon the red men, and even in our own communities the individuals fight amongst themselves
## 10 I did not see the prisoner again for several days subsequent to our first encounter, and then only to catch a fleeting glimpse of her as she was being conducted to the great audience chamber where I had had my first meeting with Lorquas Ptomel
## sentence_len
## 1 315
## 2 285
## 3 281
## 4 280
## 5 274
## 6 274
## 7 274
## 8 261
## 9 260
## 10 245
## [1] "Longest words and sentences for chapter 10"
## word word_len
## 1 enigmatical--"And 17
## 2 responsibilities 16
## 3 characteristics 15
## 4 Mars--torture, 14
## 5 companionship; 14
## 6 well-modulated 14
## 7 side-splitting 14
## 8 civilization, 13
## 9 companionship 13
## 10 disappointed. 13
## sentence
## 1 What words of moment were to have fallen from his lips were never spoken, as just then a young warrior, evidently sensing the trend of thought among the older men, leaped down from the steps of the rostrum, and striking the frail captive a powerful blow across the face, which felled her to the floor, placed his foot upon her prostrate form and turning toward the assembled council broke into peals of horrid, mirthless laughter
## 2 Numerous brilliantly colored and strangely formed wild flowers dotted the ravines and from the summit of the first hill I saw still other hills stretching off toward the north, and rising, one range above another, until lost in mountains of quite respectable dimensions; though I afterward found that only a few peaks on all Mars exceed four thousand feet in height; the suggestion of magnitude was merely relative
## 3 I saw that the body of my dead antagonist had been stripped, and I read in the menacing yet respectful attitude of the warrior who had brought me these trophies of the kill the same demeanor as that evinced by the other who had brought me my original equipment, and now for the first time I realized that my blow, on the occasion of my first battle in the audience chamber had resulted in the death of my adversary
## 4 What strange manner of man are you, that you consort with the green men, though your form is that of my race, while your color is little darker than that of the white ape? Tell me, are you human, or are you more than human?" "It is a strange tale," I replied, "too long to attempt to tell you now, and one which I so much doubt the credibility of myself that I fear to hope that others will believe it
## 5 " "Then you too are a prisoner? But why, then, those arms and the regalia of a Tharkian chieftain? What is your name? Where your country?" "Yes, Dejah Thoris, I too am a prisoner; my name is John Carter, and I claim Virginia, one of the United States of America, Earth, as my home; but why I am permitted to wear arms I do not know, nor was I aware that my regalia was that of a chieftain
## 6 Realizing that I was a somewhat favored character, and also convinced that the warriors did not know of my proficiency in their language, as I had plead with Sola to keep this a secret on the grounds that I did not wish to be forced to talk with the men until I had perfectly mastered the Martian tongue, I chanced an attempt to enter the audience chamber and listen to the proceedings
## 7 I was soon successful as her injuries amounted to little more than an ordinary nosebleed, and when she could speak she placed her hand upon my arm and looking up into my eyes, said: "Why did you do it? You who refused me even friendly recognition in the first hour of my peril! And now you risk your life and kill one of your companions for my sake
## 8 The reason for the whole attitude displayed toward me was now apparent; I had won my spurs, so to speak, and in the crude justice, which always marks Martian dealings, and which, among other things, has caused me to call her the planet of paradoxes, I was accorded the honors due a conqueror; the trappings and the position of the man I killed
## 9 I could not resist the ludicrousness of the spectacle, and holding my sides I rocked back and forth in the first laughter which had passed my lips in many days; the first, in fact, since the morning Powell had left camp when his horse, long unused, had precipitately and unexpectedly bucked him off headforemost into a pot of frijoles
## 10 " Ordinarily I am not given to long speeches, nor ever before had I descended to bombast, but I had guessed at the keynote which would strike an answering chord in the breasts of the green Martians, nor was I wrong, for my harangue evidently deeply impressed them, and their attitude toward me thereafter was still further respectful
## sentence_len
## 1 431
## 2 416
## 3 416
## 4 405
## 5 393
## 6 387
## 7 353
## 8 345
## 9 336
## 10 334
## [1] "Longest words and sentences for chapter 11"
## word word_len
## 1 circumstances. 14
## 2 questioningly. 14
## 3 different--but 14
## 4 eavesdropping, 14
## 5 accouterments 13
## 6 self-defense, 13
## 7 compositions. 13
## 8 fair-skinned, 13
## 9 un-Barsoomian 13
## 10 earthliness." 13
## sentence
## 1 During the ages of hardships and incessant warring between their own various races, as well as with the green men, and before they had fitted themselves to the changed conditions, much of the high civilization and many of the arts of the fair-haired Martians had become lost; but the red race of today has reached a point where it feels that it has made up in new discoveries and in a more practical civilization for all that lies irretrievably buried with the ancient Barsoomians, beneath the countless intervening ages
## 2 "Because, John Carter," she replied, "nearly every planet and star having atmospheric conditions at all approaching those of Barsoom, shows forms of animal life almost identical with you and me; and, further, Earth men, almost without exception, cover their bodies with strange, unsightly pieces of cloth, and their heads with hideous contraptions the purpose of which we have been unable to conceive; while you, when found by the Tharkian warriors, were entirely undisfigured and unadorned
## 3 Do not tell me that you have thus returned! They would kill you horribly anywhere upon the surface of Barsoom if that were true; tell me it is not!" Her eyes were filled with a strange, weird light; her voice was pleading, and her little hands, reached up upon my breast, were pressed against me as though to wring a denial from my very heart
## 4 A similar wave of feeling seemed to stir her; she drew away from me with a sigh, and with her earnest, beautiful face turned up to mine, she whispered: "I believe you, John Carter; I do not know what a 'gentleman' is, nor have I ever heard before of Virginia; but on Barsoom no man lies; if he does not wish to speak the truth he is silent
## 5 I can readily perceive that you are not of the Barsoom of today; you are like us, yet different--but why should I trouble my poor head with such a problem, when my heart tells me that I believe because I wish to believe!" It was good logic, good, earthly, feminine logic, and if it satisfied her I certainly could pick no flaws in it
## 6 The shores of the ancient seas were dotted with just such cities, and lesser ones, in diminishing numbers, were to be found converging toward the center of the oceans, as the people had found it necessary to follow the receding waters until necessity had forced upon them their ultimate salvation, the so-called Martian canals
## 7 "And whereto, then, would your prisoner escape should you leave her, unless it was to follow you and crave your protection, and ask your pardon for the cruel thoughts she has harbored against you these past few days?" "You are right," I answered, "there is no escape for either of us unless we go together
## 8 These three great divisions of the higher Martians had been forced into a mighty alliance as the drying up of the Martian seas had compelled them to seek the comparatively few and always diminishing fertile areas, and to defend themselves, under new conditions of life, against the wild hordes of green men
## 9 These ancient Martians had been a highly cultivated and literary race, but during the vicissitudes of those trying centuries of readjustment to new conditions, not only did their advancement and production cease entirely, but practically all their archives, records, and literature were lost
## 10 Only in the valley Dor, where the river Iss empties into the lost sea of Korus, is there supposed to be a different language spoken, and, except in the legends of our ancestors, there is no record of a Barsoomian returning up the river Iss, from the shores of Korus in the valley of Dor
## sentence_len
## 1 521
## 2 492
## 3 346
## 4 341
## 5 336
## 6 328
## 7 308
## 8 308
## 9 293
## 10 287
pomdtm <- DocumentTermMatrix(pom2)
pomdtm
## <<DocumentTermMatrix (documents: 28, terms: 9269)>>
## Non-/sparse entries: 24994/234538
## Sparsity : 90%
## Maximal term length: 19
## Weighting : term frequency (tf)
inspect(pomdtm)
## <<DocumentTermMatrix (documents: 28, terms: 9269)>>
## Non-/sparse entries: 24994/234538
## Sparsity : 90%
## Maximal term length: 19
## Weighting : term frequency (tf)
## Sample :
## Terms
## Docs and for from had his that the upon was with
## chapter_ 10 .txt 113 34 10 41 42 50 193 18 54 26
## chapter_ 14 .txt 115 41 22 35 20 43 171 18 49 33
## chapter_ 15 .txt 108 36 34 25 20 40 215 26 37 18
## chapter_ 16 .txt 113 33 20 28 8 42 265 25 54 28
## chapter_ 17 .txt 109 24 29 34 27 36 205 36 41 22
## chapter_ 20 .txt 116 26 30 30 21 40 215 18 44 25
## chapter_ 21 .txt 116 19 20 29 32 33 281 23 22 30
## chapter_ 22 .txt 93 24 20 31 15 45 208 13 38 24
## chapter_ 24 .txt 74 17 14 27 28 28 165 19 27 24
## chapter_ 3 .txt 92 18 14 19 31 26 166 20 36 20
str(pomdtm)
## List of 6
## $ i : int [1:24994] 1 1 1 1 1 1 1 1 1 1 ...
## $ j : int [1:24994] 126 130 131 139 142 188 197 208 212 218 ...
## $ v : num [1:24994] 1 1 1 1 7 1 1 4 1 1 ...
## $ nrow : int 28
## $ ncol : int 9269
## $ dimnames:List of 2
## ..$ Docs : chr [1:28] "chapter_ 1 .txt" "chapter_ 10 .txt" "chapter_ 11 .txt" "chapter_ 12 .txt" ...
## ..$ Terms: chr [1:9269] "'gentleman'" "'til" "\"'tis" "\"after" ...
## - attr(*, "class")= chr [1:2] "DocumentTermMatrix" "simple_triplet_matrix"
## - attr(*, "weighting")= chr [1:2] "term frequency" "tf"
pomtdm <- TermDocumentMatrix(pom2)
pomtdm
## <<TermDocumentMatrix (terms: 9269, documents: 28)>>
## Non-/sparse entries: 24994/234538
## Sparsity : 90%
## Maximal term length: 19
## Weighting : term frequency (tf)
removePunc <- function(x) gsub("[^[:alpha:][:space:]]*","",x)
removePunc
## function(x) gsub("[^[:alpha:][:space:]]*","",x)
pomcl <- tm::tm_map(pom2, content_transformer(removePunc))
pomcl
## <<VCorpus>>
## Metadata: corpus specific: 0, document level (indexed): 0
## Content: documents: 28
str(pomcl)
## Classes 'VCorpus', 'Corpus' hidden list of 3
## $ content:List of 28
## ..$ :List of 2
## .. ..$ content: chr [1:267] "" "ON THE ARIZONA HILLS" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 1 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:358] "" "CHAMPION AND CHIEF" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 10 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:258] "" "WITH DEJAH THORIS" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 11 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:204] "" "A PRISONER WITH POWER" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 12 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:244] "" "LOVEMAKING ON MARS" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 13 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:350] "" "A DUEL TO THE DEATH" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 14 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:313] "" "SOLA TELLS ME HER STORY" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 15 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:369] "" "WE PLAN ESCAPE" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 16 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:289] "" "A COSTLY RECAPTURE" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 17 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:167] "" "CHAINED IN WARHOON" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 18 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:183] "" "BATTLING IN THE ARENA" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 19 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:166] "" "THE ESCAPE OF THE DEAD" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 2 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:341] "" "IN THE ATMOSPHERE FACTORY" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 20 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:373] "" "AN AIR SCOUT FOR ZODANGA" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 21 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:389] "" "I FIND DEJAH" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 22 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:240] "" "LOST IN THE SKY" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 23 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:289] "" "TARS TARKAS FINDS A FRIEND" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 24 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:193] "" "THE LOOTING OF ZODANGA" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 25 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:254] "" "THROUGH CARNAGE TO JOY" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 26 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:225] "" "FROM JOY TO DEATH" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 27 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:75] "" "AT THE ARIZONA CAVE" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 28 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:268] "" "MY ADVENT ON MARS" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 3 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:221] "" "A PRISONER" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 4 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:152] "" "I ELUDE MY WATCH DOG" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 5 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:165] "" "A FIGHT THAT WON FRIENDS" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 6 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:204] "" "CHILDRAISING ON MARS" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 7 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:207] "" "A FAIR CAPTIVE FROM THE SKY" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 8 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:148] "" "I LEARN THE LANGUAGE" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 9 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## $ meta : list()
## ..- attr(*, "class")= chr "CorpusMeta"
## $ dmeta :'data.frame': 28 obs. of 0 variables
inspect(pomcl)
## <<VCorpus>>
## Metadata: corpus specific: 0, document level (indexed): 0
## Content: documents: 28
##
## [[1]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 13711
##
## [[2]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 18669
##
## [[3]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 12812
##
## [[4]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 10221
##
## [[5]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 12200
##
## [[6]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 16816
##
## [[7]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 16518
##
## [[8]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 19871
##
## [[9]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 15626
##
## [[10]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 7954
##
## [[11]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 9271
##
## [[12]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 8844
##
## [[13]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 17371
##
## [[14]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 19013
##
## [[15]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 18167
##
## [[16]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 11601
##
## [[17]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 13818
##
## [[18]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 9477
##
## [[19]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 12019
##
## [[20]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 9760
##
## [[21]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 3403
##
## [[22]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 13921
##
## [[23]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 11591
##
## [[24]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 8210
##
## [[25]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 8679
##
## [[26]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 11012
##
## [[27]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 11090
##
## [[28]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 7617
pomlow <- tm::tm_map(pomcl, content_transformer(tolower))
pomlow
## <<VCorpus>>
## Metadata: corpus specific: 0, document level (indexed): 0
## Content: documents: 28
str(pomlow)
## Classes 'VCorpus', 'Corpus' hidden list of 3
## $ content:List of 28
## ..$ :List of 2
## .. ..$ content: chr [1:267] "" "on the arizona hills" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 1 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:358] "" "champion and chief" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 10 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:258] "" "with dejah thoris" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 11 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:204] "" "a prisoner with power" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 12 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:244] "" "lovemaking on mars" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 13 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:350] "" "a duel to the death" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 14 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:313] "" "sola tells me her story" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 15 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:369] "" "we plan escape" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 16 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:289] "" "a costly recapture" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 17 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:167] "" "chained in warhoon" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 18 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:183] "" "battling in the arena" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 19 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:166] "" "the escape of the dead" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 2 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:341] "" "in the atmosphere factory" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 20 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:373] "" "an air scout for zodanga" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 21 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:389] "" "i find dejah" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 22 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:240] "" "lost in the sky" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 23 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:289] "" "tars tarkas finds a friend" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 24 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:193] "" "the looting of zodanga" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 25 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:254] "" "through carnage to joy" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 26 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:225] "" "from joy to death" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 27 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:75] "" "at the arizona cave" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 28 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:268] "" "my advent on mars" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 3 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:221] "" "a prisoner" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 4 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:152] "" "i elude my watch dog" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 5 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:165] "" "a fight that won friends" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 6 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:204] "" "childraising on mars" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 7 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:207] "" "a fair captive from the sky" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 8 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## ..$ :List of 2
## .. ..$ content: chr [1:148] "" "i learn the language" "" "" ...
## .. ..$ meta :List of 7
## .. .. ..$ author : chr(0)
## .. .. ..$ datetimestamp: POSIXlt[1:1], format: "2023-05-02 08:05:51"
## .. .. ..$ description : chr(0)
## .. .. ..$ heading : chr(0)
## .. .. ..$ id : chr "chapter_ 9 .txt"
## .. .. ..$ language : chr "en"
## .. .. ..$ origin : chr(0)
## .. .. ..- attr(*, "class")= chr "TextDocumentMeta"
## .. ..- attr(*, "class")= chr [1:2] "PlainTextDocument" "TextDocument"
## $ meta : list()
## ..- attr(*, "class")= chr "CorpusMeta"
## $ dmeta :'data.frame': 28 obs. of 0 variables
inspect(pomlow)
## <<VCorpus>>
## Metadata: corpus specific: 0, document level (indexed): 0
## Content: documents: 28
##
## [[1]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 13711
##
## [[2]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 18669
##
## [[3]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 12812
##
## [[4]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 10221
##
## [[5]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 12200
##
## [[6]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 16816
##
## [[7]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 16518
##
## [[8]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 19871
##
## [[9]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 15626
##
## [[10]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 7954
##
## [[11]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 9271
##
## [[12]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 8844
##
## [[13]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 17371
##
## [[14]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 19013
##
## [[15]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 18167
##
## [[16]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 11601
##
## [[17]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 13818
##
## [[18]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 9477
##
## [[19]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 12019
##
## [[20]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 9760
##
## [[21]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 3403
##
## [[22]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 13921
##
## [[23]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 11591
##
## [[24]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 8210
##
## [[25]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 8679
##
## [[26]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 11012
##
## [[27]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 11090
##
## [[28]]
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 7617
pomdtm <- DocumentTermMatrix(pomlow)
pomdtm
## <<DocumentTermMatrix (documents: 28, terms: 6487)>>
## Non-/sparse entries: 21829/159807
## Sparsity : 88%
## Maximal term length: 17
## Weighting : term frequency (tf)
str(pomdtm)
## List of 6
## $ i : int [1:21829] 1 1 1 1 1 1 1 1 1 1 ...
## $ j : int [1:21829] 5 8 45 53 62 64 69 106 108 124 ...
## $ v : num [1:21829] 1 7 1 1 4 1 1 1 1 3 ...
## $ nrow : int 28
## $ ncol : int 6487
## $ dimnames:List of 2
## ..$ Docs : chr [1:28] "chapter_ 1 .txt" "chapter_ 10 .txt" "chapter_ 11 .txt" "chapter_ 12 .txt" ...
## ..$ Terms: chr [1:6487] "abandoning" "abash" "abashed" "ability" ...
## - attr(*, "class")= chr [1:2] "DocumentTermMatrix" "simple_triplet_matrix"
## - attr(*, "weighting")= chr [1:2] "term frequency" "tf"
inspect(pomdtm)
## <<DocumentTermMatrix (documents: 28, terms: 6487)>>
## Non-/sparse entries: 21829/159807
## Sparsity : 88%
## Maximal term length: 17
## Weighting : term frequency (tf)
## Sample :
## Terms
## Docs and but for had that the upon was which with
## chapter_ 10 .txt 117 20 34 41 50 193 19 54 16 26
## chapter_ 14 .txt 118 20 43 35 45 172 18 50 10 34
## chapter_ 15 .txt 116 31 36 25 41 216 26 37 22 19
## chapter_ 16 .txt 119 31 34 28 44 266 25 54 26 29
## chapter_ 17 .txt 114 23 24 34 36 206 37 41 13 22
## chapter_ 20 .txt 120 20 26 30 40 216 18 44 35 25
## chapter_ 21 .txt 118 17 19 29 34 282 23 22 25 30
## chapter_ 22 .txt 104 29 24 31 48 212 13 41 19 24
## chapter_ 24 .txt 77 15 17 27 29 166 19 27 6 24
## chapter_ 3 .txt 94 17 18 19 26 166 20 37 34 20
sparse_low <- removeSparseTerms(pomtdm, 0.5)
sparse_low
## <<TermDocumentMatrix (terms: 242, documents: 28)>>
## Non-/sparse entries: 5015/1761
## Sparsity : 26%
## Maximal term length: 10
## Weighting : term frequency (tf)
myStopwords<- c(tm::stopwords("english"))
myStopwords[1:20]
## [1] "i" "me" "my" "myself" "we"
## [6] "our" "ours" "ourselves" "you" "your"
## [11] "yours" "yourself" "yourselves" "he" "him"
## [16] "his" "himself" "she" "her" "hers"
pomstop <- tm::tm_map(pomlow, tm::removeWords, myStopwords)
pomstop
## <<VCorpus>>
## Metadata: corpus specific: 0, document level (indexed): 0
## Content: documents: 28
inspect(pomstop[[1]])
## <<PlainTextDocument>>
## Metadata: 7
## Content: chars: 9812
##
##
## arizona hills
##
##
## old man old know possibly hundred
## possibly tell never aged
## men remember childhood far can recollect
## always man man thirty appear today
## forty years ago yet feel go living
## forever day shall die real death
## resurrection know fear death
## died twice still alive yet horror
## never died terror death
## believe convinced mortality
##
## conviction determined write
## story interesting periods life death
## explain phenomena can set words
## ordinary soldier fortune chronicle strange events
## befell ten years dead body lay undiscovered
## arizona cave
##
## never told story shall mortal man see manuscript
## passed eternity know average
## human mind will believe grasp
## purpose pilloried public pulpit press
## held colossal liar telling simple truths
## day science will substantiate possibly suggestions
## gained upon mars knowledge can set
## chronicle will aid earlier understanding mysteries
## sister planet mysteries longer mysteries
##
## name john carter better known captain jack carter
## virginia close civil war found possessed
## several hundred thousand dollars confederate captains
## commission cavalry arm army longer existed
## servant state vanished hopes south
## masterless penniless means livelihood fighting
## gone determined work way southwest attempt
## retrieve fallen fortunes search gold
##
## spent nearly year prospecting company another confederate
## officer captain james k powell richmond extremely
## fortunate late winter many hardships
## privations located remarkable goldbearing quartz vein
## wildest dreams ever pictured powell mining
## engineer education stated uncovered million
## dollars worth ore trifle three months
##
## equipment crude extreme decided one us
## must return civilization purchase necessary machinery
## return sufficient force men properly work mine
##
## powell familiar country well mechanical
## requirements mining determined best
## make trip agreed hold claim
## remote possibility jumped wandering prospector
##
## march powell packed provisions two
## burros bidding goodbye mounted horse started
## mountainside toward valley across led first stage
## journey
##
## morning powells departure like nearly arizona
## mornings clear beautiful see little pack
## animals picking way mountainside toward valley
## morning catch occasional glimpses
## topped hog back came upon level plateau last sight
## powell three afternoon entered shadows
## range opposite side valley
##
## half hour later happened glance casually across valley
## much surprised note three little dots
## place last seen friend two pack animals
## given needless worrying tried convince
## well powell dots seen
## trail antelope wild horses less able assure
##
##
## since entered territory seen hostile indian
## therefore become careless extreme wont
## ridicule stories heard great numbers vicious
## marauders supposed haunt trails taking toll
## lives torture every white party fell merciless
## clutches
##
## powell knew well armed experienced indian
## fighter lived fought years among sioux
## north knew chances small party
## cunning trailing apaches finally endure suspense
## longer arming two colt revolvers carbine
## strapped two belts cartridges catching saddle horse
## started trail taken powell morning
##
## soon reached comparatively level ground urged mount
## canter continued going permitted close upon
## dusk discovered point tracks joined powell
## tracks unshod ponies three ponies
## galloping
##
## followed rapidly darkness shutting forced await
## rising moon given opportunity speculate
## question wisdom chase possibly conjured
## impossible dangers like nervous old housewife
## catch powell get good laugh pains however
## prone sensitiveness following sense duty
## wherever may lead always kind fetich
## throughout life may account honors bestowed upon
## three republics decorations friendships old
## powerful emperor several lesser kings whose service sword
## red many time
##
## nine oclock moon sufficiently bright proceed
## way difficulty following trail fast
## walk places brisk trot midnight
## reached water hole powell expected camp came upon
## spot unexpectedly finding entirely deserted signs
## recently occupied camp
##
## interested note tracks pursuing horsemen
## now convinced must continued powell
## brief stop hole water always rate
## speed
##
## positive now trailers apaches wished
## capture powell alive fiendish pleasure torture
## urged horse onward dangerous pace hoping hope
## catch red rascals attacked
##
## speculation suddenly cut short faint report two
## shots far ahead knew powell need now ever
## instantly urged horse topmost speed narrow
## difficult mountain trail
##
## forged ahead perhaps mile without hearing
## sounds trail suddenly debouched onto small open plateau
## near summit pass passed narrow
## overhanging gorge just entering suddenly upon table land
## sight met eyes filled consternation dismay
##
## little stretch level land white indian tepees
## probably half thousand red warriors clustered around
## object near center camp attention wholly
## riveted point interest notice
## easily turned back dark recesses gorge
## made escape perfect safety fact however
## thought occur following day removes
## possible right claim heroism narration
## episode might possibly otherwise entitle
##
## believe made stuff constitutes heroes
## hundreds instances voluntary acts
## placed face face death recall single one
## alternative step took occurred many
## hours later mind evidently constituted
## subconsciously forced path duty without recourse
## tiresome mental processes however may never regretted
## cowardice optional
##
## instance course positive powell center
## attraction whether thought acted first know
## within instant moment scene broke upon view
## whipped revolvers charging upon entire army
## warriors shooting rapidly whooping top lungs
## singlehanded pursued better tactics red men
## convinced sudden surprise less regiment regulars
## upon turned fled every direction bows
## arrows rifles
##
## view hurried routing disclosed filled
## apprehension rage clear rays arizona moon
## lay powell body fairly bristling hostile arrows
## braves already dead convinced yet
## saved body mutilation hands apaches
## quickly saved man death
##
## riding close reached saddle grasping
## cartridge belt drew across withers mount backward
## glance convinced return way come
## hazardous continue across plateau putting spurs
## poor beast made dash opening pass
## distinguish far side table land
##
## indians time discovered alone
## pursued imprecations arrows rifle balls fact
## difficult aim anything imprecations accurately moonlight
## upset sudden unexpected manner advent
## rather rapidly moving target saved various
## deadly projectiles enemy permitted reach shadows
## surrounding peaks orderly pursuit organized
##
## horse traveling practically unguided knew
## probably less knowledge exact location trail pass
## thus happened entered defile led
## summit range pass hoped carry
## valley safety probable however
## fact owe life remarkable experiences adventures
## befell following ten years
##
## first knowledge wrong trail came heard
## yells pursuing savages suddenly grow fainter fainter far
## left
##
## knew passed left jagged rock
## formation edge plateau right horse
## borne body powell
##
## drew rein little level promontory overlooking trail
## left saw party pursuing savages disappearing
## around point neighboring peak
##
## knew indians soon discover wrong
## trail search renewed right
## direction soon located tracks
##
## gone short distance seemed
## excellent trail opened around face high cliff trail
## level quite broad led upward general direction
## wished go cliff arose several hundred feet right
## left equal nearly perpendicular drop bottom
## rocky ravine
##
## followed trail perhaps hundred yards sharp turn
## right brought mouth large cave opening
## four feet height three four feet wide
## opening trail ended
##
## now morning customary lack dawn
## startling characteristic arizona become daylight almost
## without warning
##
## dismounting laid powell upon ground painstaking
## examination failed reveal faintest spark life forced
## water canteen dead lips bathed face rubbed
## hands working continuously better part hour
## face fact knew dead
##
## fond powell thoroughly man every respect
## polished southern gentleman staunch true friend
## feeling deepest grief finally gave crude
## endeavors resuscitation
##
## leaving powells body lay ledge crept cave
## reconnoiter found large chamber possibly hundred feet
## diameter thirty forty feet height smooth wellworn
## floor many evidences cave remote
## period inhabited back cave lost dense
## shadow distinguish whether openings
## apartments
##
## continuing examination commenced feel pleasant
## drowsiness creeping attributed fatigue
## long strenuous ride reaction excitement
## fight pursuit felt comparatively safe present
## location knew one man defend trail cave
## army
##
## soon became drowsy scarcely resist strong desire
## throw floor cave moments rest
## knew never mean certain death
## hands red friends might upon moment
## effort started toward opening cave reel drunkenly
## side wall slip prone upon floor
pomstoptdm <- tm::TermDocumentMatrix(pomstop)
pomstoptdm
## <<TermDocumentMatrix (terms: 6388, documents: 28)>>
## Non-/sparse entries: 19772/159092
## Sparsity : 89%
## Maximal term length: 17
## Weighting : term frequency (tf)
freqterm5 <- tm::findFreqTerms(pomstoptdm, lowfreq = 5)
freqterm5[1:20]
## [1] "ability" "able" "absence" "absolute" "absolutely"
## [6] "accompanied" "accompany" "accomplished" "accordance" "account"
## [11] "across" "act" "actions" "added" "addressed"
## [16] "adjoining" "advance" "advanced" "advantage" "advent"
freqterm10 <- tm::findFreqTerms(pomstoptdm, lowfreq = 10)
freqterm10[1:20]
## [1] "ability" "able" "accompanied" "across" "added"
## [6] "addressed" "advance" "advanced" "ages" "ago"
## [11] "aid" "air" "almost" "alone" "along"
## [16] "already" "also" "always" "among" "ancient"
freqterm20 <- tm::findFreqTerms(pomstoptdm, lowfreq = 20)
freqterm20[1:20]
## [1] "across" "advanced" "air" "almost" "alone"
## [6] "also" "always" "among" "animals" "another"
## [11] "answered" "approached" "arm" "arms" "around"
## [16] "asked" "attempt" "away" "awful" "back"
freqterm50 <- tm::findFreqTerms(pomstoptdm, lowfreq = 50)
freqterm50[1:20]
## [1] "among" "another" "back" "barsoom" "behind" "body"
## [7] "building" "came" "can" "carter" "city" "day"
## [13] "days" "dead" "death" "dejah" "even" "ever"
## [19] "eyes" "face"
for(i in 1:11){
assign(paste0("pomtf_chap",i), tm::termFreq(pomstop[[i]]))
print(paste("For chapter",i))
print(get(eval(paste0("pomtf_chap",i)))[1:5])
}
## [1] "For chapter 1"
## able account accurately across acted
## 1 1 1 4 1
## [1] "For chapter 2"
## ability accordance accorded according accounted
## 2 1 2 1 1
## [1] "For chapter 3"
## absence accompanied accouterments across adjoining
## 2 1 1 1 1
## [1] "For chapter 4"
## ablest absolute absolutely abysmal accompanied
## 1 1 1 1 1
## [1] "For chapter 5"
## abandoning absence absent absolute accidentally
## 1 1 1 1 1
## [1] "For chapter 6"
## ability able accompany accorded across
## 1 1 1 1 1
## [1] "For chapter 7"
## abreast absence absences absolute abuse
## 1 1 1 2 2
## [1] "For chapter 8"
## ability able abreast absence accept
## 1 1 1 1 1
## [1] "For chapter 9"
## able accentuated accentuating across action
## 1 1 1 2 1
## [1] "For chapter 10"
## added addressed advanced adversary affront
## 1 1 1 1 1
## [1] "For chapter 11"
## accorded account acquainted address admiration
## 1 1 1 1 1
for(i in 1:11){
tdm <- tm::TermDocumentMatrix(pomstop[[i]])
df <- as.data.frame(tdm[[1]])
pomdist <- dist(df)
assign(paste0("pomdg_chap",i), hclust(pomdist, method = "ward.D2"))
print(paste("For chapter",i))
print(str(get(eval(paste0("pomdg_chap",i)))))
}
## [1] "For chapter 1"
## List of 7
## $ merge : int [1:1192, 1:2] -1 -273 -785 -1036 -3 -997 -1010 -1103 -4 -90 ...
## $ height : num [1:1192] 0 0 0 0 0 0 0 0 0 0 ...
## $ order : int [1:1193] 1146 1147 1149 1151 1158 1159 1160 1161 1182 1183 ...
## $ labels : NULL
## $ method : chr "ward.D2"
## $ call : language hclust(d = pomdist, method = "ward.D2")
## $ dist.method: chr "euclidean"
## - attr(*, "class")= chr "hclust"
## NULL
## [1] "For chapter 2"
## List of 7
## $ merge : int [1:1632, 1:2] -2 -5 -1385 -7 -8 -282 -10 -576 -1101 -1192 ...
## $ height : num [1:1632] 0 0 0 0 0 0 0 0 0 0 ...
## $ order : int [1:1633] 1617 1623 1633 1625 1630 1600 1601 1602 1605 1608 ...
## $ labels : NULL
## $ method : chr "ward.D2"
## $ call : language hclust(d = pomdist, method = "ward.D2")
## $ dist.method: chr "euclidean"
## - attr(*, "class")= chr "hclust"
## NULL
## [1] "For chapter 3"
## List of 7
## $ merge : int [1:1090, 1:2] -1 -40 -48 -72 -175 -225 -254 -280 -297 -301 ...
## $ height : num [1:1090] 0 0 0 0 0 0 0 0 0 0 ...
## $ order : int [1:1091] 77 78 83 71 1009 73 673 1084 1037 1031 ...
## $ labels : NULL
## $ method : chr "ward.D2"
## $ call : language hclust(d = pomdist, method = "ward.D2")
## $ dist.method: chr "euclidean"
## - attr(*, "class")= chr "hclust"
## NULL
## [1] "For chapter 4"
## List of 7
## $ merge : int [1:880, 1:2] -1 -2 -55 -60 -400 -5 -224 -240 -6 -225 ...
## $ height : num [1:880] 0 0 0 0 0 0 0 0 0 0 ...
## $ order : int [1:881] 23 24 800 743 723 420 393 182 21 128 ...
## $ labels : NULL
## $ method : chr "ward.D2"
## $ call : language hclust(d = pomdist, method = "ward.D2")
## $ dist.method: chr "euclidean"
## - attr(*, "class")= chr "hclust"
## NULL
## [1] "For chapter 5"
## List of 7
## $ merge : int [1:1068, 1:2] -2 -3 -4 -359 -627 -636 -5 -277 -328 -541 ...
## $ height : num [1:1068] 0 0 0 0 0 0 0 0 0 0 ...
## $ order : int [1:1069] 803 895 801 802 804 807 808 809 786 790 ...
## $ labels : NULL
## $ method : chr "ward.D2"
## $ call : language hclust(d = pomdist, method = "ward.D2")
## $ dist.method: chr "euclidean"
## - attr(*, "class")= chr "hclust"
## NULL
## [1] "For chapter 6"
## List of 7
## $ merge : int [1:1475, 1:2] -1 -3 -5 -185 -196 -209 -247 -257 -262 -347 ...
## $ height : num [1:1475] 0 0 0 0 0 0 0 0 0 0 ...
## $ order : int [1:1476] 1081 1083 1087 1088 1089 1091 1092 1093 1095 1097 ...
## $ labels : NULL
## $ method : chr "ward.D2"
## $ call : language hclust(d = pomdist, method = "ward.D2")
## $ dist.method: chr "euclidean"
## - attr(*, "class")= chr "hclust"
## NULL
## [1] "For chapter 7"
## List of 7
## $ merge : int [1:1494, 1:2] -1 -178 -188 -207 -272 -302 -325 -578 -1395 -2 ...
## $ height : num [1:1494] 0 0 0 0 0 0 0 0 0 0 ...
## $ order : int [1:1495] 1176 1177 1178 1179 1167 1168 1195 1169 1170 1171 ...
## $ labels : NULL
## $ method : chr "ward.D2"
## $ call : language hclust(d = pomdist, method = "ward.D2")
## $ dist.method: chr "euclidean"
## - attr(*, "class")= chr "hclust"
## NULL
## [1] "For chapter 8"
## List of 7
## $ merge : int [1:1746, 1:2] -1 -611 -815 -865 -919 -1044 -1409 -1437 -2 -5 ...
## $ height : num [1:1746] 0 0 0 0 0 0 0 0 0 0 ...
## $ order : int [1:1747] 87 169 85 1367 1180 1155 1109 1053 86 659 ...
## $ labels : NULL
## $ method : chr "ward.D2"
## $ call : language hclust(d = pomdist, method = "ward.D2")
## $ dist.method: chr "euclidean"
## - attr(*, "class")= chr "hclust"
## NULL
## [1] "For chapter 9"
## List of 7
## $ merge : int [1:1414, 1:2] -2 -6 -8 -1228 -12 -282 -13 -14 -948 -965 ...
## $ height : num [1:1414] 0 0 0 0 0 0 0 0 0 0 ...
## $ order : int [1:1415] 1038 1040 1042 1044 1047 1048 1075 1051 1053 1054 ...
## $ labels : NULL
## $ method : chr "ward.D2"
## $ call : language hclust(d = pomdist, method = "ward.D2")
## $ dist.method: chr "euclidean"
## - attr(*, "class")= chr "hclust"
## NULL
## [1] "For chapter 10"
## List of 7
## $ merge : int [1:742, 1:2] -1 -2 -267 -435 -479 -500 -516 -7 -8 -13 ...
## $ height : num [1:742] 0 0 0 0 0 0 0 0 0 0 ...
## $ order : int [1:743] 1 518 516 500 479 435 267 2 159 7 ...
## $ labels : NULL
## $ method : chr "ward.D2"
## $ call : language hclust(d = pomdist, method = "ward.D2")
## $ dist.method: chr "euclidean"
## - attr(*, "class")= chr "hclust"
## NULL
## [1] "For chapter 11"
## List of 7
## $ merge : int [1:844, 1:2] -1 -400 -458 -507 -520 -559 -618 -722 -809 -6 ...
## $ height : num [1:844] 0 0 0 0 0 0 0 0 0 0 ...
## $ order : int [1:845] 225 19 119 20 21 11 12 13 14 18 ...
## $ labels : NULL
## $ method : chr "ward.D2"
## $ call : language hclust(d = pomdist, method = "ward.D2")
## $ dist.method: chr "euclidean"
## - attr(*, "class")= chr "hclust"
## NULL
for(i in 1:11){
plot(get(eval(paste0("pomdg_chap",i))), main = paste0("Dendogram - Chapter ",i))
}
### Word Cloud
#install.packages("wordcloud")
library(wordcloud)
## Loading required package: RColorBrewer
words <- names(pomtf_chap1)
words[1:50]
## [1] "able" "account" "accurately" "across" "acted"
## [6] "acts" "advent" "adventures" "afternoon" "aged"
## [11] "ago" "agreed" "ahead" "aid" "aim"
## [16] "alive" "almost" "alone" "already" "alternative"
## [21] "always" "among" "animals" "another" "antelope"
## [26] "anything" "apaches" "apartments" "appear" "apprehension"
## [31] "arizona" "arm" "armed" "arming" "army"
## [36] "arose" "around" "arrows" "assure" "attacked"
## [41] "attempt" "attention" "attraction" "attributed" "average"
## [46] "await" "back" "backward" "balls" "bathed"
pal <- brewer.pal(9,"BuGn")
for(i in 1:11){
print(paste("Wordcloud for chapter",i))
tf <- get(eval(paste0("pomtf_chap",i)))
words <- names(tf)
wordcloud(words, tf, colors = pal[-(1:4)], scale=c(4, .5))
}
## [1] "Wordcloud for chapter 1"
## [1] "Wordcloud for chapter 2"
## Warning in wordcloud(words, tf, colors = pal[-(1:4)], scale = c(4, 0.5)):
## chieftain could not be fit on page. It will not be plotted.
## Warning in wordcloud(words, tf, colors = pal[-(1:4)], scale = c(4, 0.5)): know
## could not be fit on page. It will not be plotted.
## [1] "Wordcloud for chapter 3"
## [1] "Wordcloud for chapter 4"
## Warning in wordcloud(words, tf, colors = pal[-(1:4)], scale = c(4, 0.5)): one
## could not be fit on page. It will not be plotted.
## Warning in wordcloud(words, tf, colors = pal[-(1:4)], scale = c(4, 0.5)): upon
## could not be fit on page. It will not be plotted.
## Warning in wordcloud(words, tf, colors = pal[-(1:4)], scale = c(4, 0.5)):
## sleeping could not be fit on page. It will not be plotted.
## [1] "Wordcloud for chapter 5"
## Warning in wordcloud(words, tf, colors = pal[-(1:4)], scale = c(4, 0.5)): upon
## could not be fit on page. It will not be plotted.
## [1] "Wordcloud for chapter 6"
## [1] "Wordcloud for chapter 7"
## [1] "Wordcloud for chapter 8"
## Warning in wordcloud(words, tf, colors = pal[-(1:4)], scale = c(4, 0.5)): dejah
## could not be fit on page. It will not be plotted.
## [1] "Wordcloud for chapter 9"
## [1] "Wordcloud for chapter 10"
## [1] "Wordcloud for chapter 11"
pal2 <- brewer.pal(8,"Spectral")
for(i in 1:11){
print(paste("Wordcloud for chapter",i))
tf <- get(eval(paste0("pomtf_chap",i)))
words <- names(tf)
wordcloud(words, tf, colors = pal2, scale=c(4, .5))
}
## [1] "Wordcloud for chapter 1"
## Warning in wordcloud(words, tf, colors = pal2, scale = c(4, 0.5)): powell could
## not be fit on page. It will not be plotted.
## [1] "Wordcloud for chapter 2"
## Warning in wordcloud(words, tf, colors = pal2, scale = c(4, 0.5)): upon could
## not be fit on page. It will not be plotted.
## Warning in wordcloud(words, tf, colors = pal2, scale = c(4, 0.5)): one could not
## be fit on page. It will not be plotted.
## Warning in wordcloud(words, tf, colors = pal2, scale = c(4, 0.5)): martian could
## not be fit on page. It will not be plotted.
## [1] "Wordcloud for chapter 3"
## Warning in wordcloud(words, tf, colors = pal2, scale = c(4, 0.5)): dejah could
## not be fit on page. It will not be plotted.
## [1] "Wordcloud for chapter 4"
## Warning in wordcloud(words, tf, colors = pal2, scale = c(4, 0.5)): community
## could not be fit on page. It will not be plotted.
## Warning in wordcloud(words, tf, colors = pal2, scale = c(4, 0.5)): greatest
## could not be fit on page. It will not be plotted.
## Warning in wordcloud(words, tf, colors = pal2, scale = c(4, 0.5)): tarkas could
## not be fit on page. It will not be plotted.
## [1] "Wordcloud for chapter 5"
## [1] "Wordcloud for chapter 6"
## [1] "Wordcloud for chapter 7"
## [1] "Wordcloud for chapter 8"
## Warning in wordcloud(words, tf, colors = pal2, scale = c(4, 0.5)): dejah could
## not be fit on page. It will not be plotted.
## [1] "Wordcloud for chapter 9"
## [1] "Wordcloud for chapter 10"
## [1] "Wordcloud for chapter 11"